#ifndef CLICKEDLABEL_H
#define CLICKEDLABEL_H
#include <QLabel>
#include <QWidget>
#include <QEvent>
#include <QMouseEvent>

class ClickableLabel : public QLabel
{
    Q_OBJECT
signals:
    void Clicked(ClickableLabel* clicked);

public:
    ClickableLabel(QWidget *parent=0): QLabel(parent)
    {
        checked = true;
        defaultColor="rgba(255,255,255,20)";

        setAlignment(Qt::AlignCenter);
    }

    bool isChecked(){return checked;}

    void setChecked(bool value){checked = value; setBackground();}

    void setColor(QString color)
    {
        defaultColor = color;
        if(checked)
        {
            setStyleSheet("background-color:"+defaultColor);
        }
    }

protected:
    void mouseReleaseEvent(QMouseEvent *);
    void mousePressEvent(QMouseEvent *);

private:
    QString m_str;
    QString defaultColor;
    bool checked;

    void setBackground();
};
#endif // CLICKEDLABEL_H
